import React from "react";
import { Input, Form } from "antd";
import { ParamType } from "types";
import UserSelect from "components/user-select";

interface IProps {
  param: Partial<ParamType>;
  setParam: (params: Partial<ParamType>) => void;
}

const SearchPanel: React.FC<IProps> = ({ param, setParam }) => {
  return (
    <Form layout="inline" style={{ marginBottom: "2rem" }}>
      <Form.Item>
        <Input
          placeholder="项目名"
          onChange={(e) => {
            setParam({ ...param, name: e.currentTarget.value });
          }}
        />
      </Form.Item>
      <Form.Item>
        <UserSelect
          defaultOptionName="负责人"
          value={param.personId}
          onChange={(val) => {
            setParam({ ...param, personId: val });
          }}
        />
      </Form.Item>
    </Form>
  );
};

export default SearchPanel;
